
package hospital;

import java.io.*; 
import java.net.*; 
class clienteTCP { 

    public static void main(String argv[]) throws Exception 
    { 
        String frase; 
         
        Message men = new Message();
     
        Socket socketCliente = new Socket("localhost", 6789); 
        frase = "Consulta"; 
        men.setCommand("low");
        men.setData(frase);

        ObjectOutputStream paraOservidor = new ObjectOutputStream (socketCliente.getOutputStream());
        ObjectInputStream vindoDoServidor = new ObjectInputStream (socketCliente.getInputStream());

        paraOservidor.writeObject(men);
        Message fin = (Message)vindoDoServidor.readObject();
        
        System.out.println("Do Servidor: " + fin.getData());
        socketCliente.close(); 
                     
      } 
  } 
